<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        class person {
            //构造器函数，实例的属性，可写
            constructor(name,age){
             this.name=name
             this.age=age
            }
            //实例的属性，不可传参
            address='尚硅谷';
            //实例上的方法
            do=function(){
                console.log("do");
            }
            //原型上的方法
            eat(){
                console.log("eat");
            }
            //静态方法
            static say='hello react'            
        }
        // 创建子类
        class student extends person {
            constructor(name,age,score){
                //super构建this，继承父类的属性
                super(name,age)
                this.score=score
            }
            study='react'
            sleep(){
                console.log('上课睡觉');
            }    
        }
        const ming=new student('名',18,'学习')
        console.log(ming,'ming');
        person.say
        ming.eat()
    </script>
</body>
</html>